//
//  UserAgreementViewController.m
//  WeCommunity
//
//  Created by mac on 2017/7/28.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "UserAgreementViewController.h"
#import "CheckAPPSetting.h"

@interface UserAgreementViewController ()

@property (nonatomic,strong) UIScrollView * scrollView;
@property (nonatomic,strong) UILabel * contentLabel;

@end

@implementation UserAgreementViewController

-(UIScrollView *)scrollView
{
    if (!_scrollView) {
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, KNaviheight, KScreen_Width, KScreen_Height - KNaviheight)];
        _scrollView.bounces = NO;
    }
    return _scrollView;
}

-(UILabel *)contentLabel
{
    if (!_contentLabel) {
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, KScreen_Width, MAXFLOAT)];
        
        NSArray * array = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"userAgreement.plist" ofType:nil]];
        if ([CheckAPPSetting currentLanguageIsChinese]) {
            _contentLabel.text = array[1];
        }else{
            _contentLabel.text = array[0];
        }
        
        _contentLabel.textColor = [UIColor blackColor];
        _contentLabel.font = PFR_FONT(14);
        _contentLabel.numberOfLines = 0;
        [_contentLabel sizeToFit];
        
        [self.scrollView setContentSize:CGSizeMake(KScreen_Width, CGRectGetMaxY(_contentLabel.frame))];
    }
    return _contentLabel;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self initWithUserInterface];
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

-(void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

-(void)initWithUserInterface
{
    //状态栏
    [UITool setStatusBarIsWhite:NO];
    
    self.navigationItem.leftBarButtonItem = self.leftBtnItem;
    
    self.title = KNSLocal(@"userAgreementTitle");
    
    [self.view addSubview:self.scrollView];
    
    [self.scrollView addSubview:self.contentLabel];
}

#pragma mark - 取消
-(void)cancel
{
   [self.navigationController popViewControllerAnimated:YES];
}

@end
